$(function() {
    $.get(
        url + "User/clients",
        function(reg) {
            var html = "";
            if (reg.status == "success") {
                for (var i = 0; i < reg.reson.length; i++) {
                    if (reg.reson[i].is_often == 1) {
                        html += "<div class=\"col-sm-4\">";
                        html += "                <div class=\"contact-box\">";
                        html += "                    <a href=\"javascript:void(0;\">";
                        html += "                        <div class=\"col-sm-4\">";
                        html += "                            <div class=\"text-center\">";
                        html += "                                <img alt=\"image\" class=\"img-circle m-t-xs img-responsive\" src=\"img/a2.jpg\">";
                        html += "                                ";
                        html += "                            </div>";
                        html += "                        </div>";
                        html += "                        <div class=\"col-sm-8\">";
                        html += "                            <h3><strong>" + reg.reson[i].name + "</strong></h3>";
                        html += "                            <p><i class=\"fa fa-map-marker\"></i> " + reg.reson[i].region + "·" + reg.reson[i].address + "</p>";
                        html += "                            <address>";
                        html += "                            ";
                        html += "                            <abbr title=\"Phone\">电话:</abbr> " + reg.reson[i].phone;
                        html += "                        </address>";
                        html += "                        </div>";
                        html += "<strong>" + tran(reg.reson[i].type) + "</strong>";
                        html += "                        <div class=\"clearfix\"></div>";
                        html += "                    </a>";
                        html += "                </div>";
                        html += "            </div>";
                    }
                }
                $("#clients").empty();
                $("#clients").append(html);
                // $('.contact-box').each(function() {
                //     animationHover(this, 'pulse');
                // });
            } else {
                layer.msg(reg.reson, { icon: 2 });
            }
        },
        'json'
    );
});

function tran(str) {
    return (str == 1) ? "客户" : "供货商";
}
